package com.company.service;

import com.company.dao.NewsDao;
import com.company.entity.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsService {
    @Autowired
    NewsDao newsDao;

    public News query(int id) {
        return newsDao.getOne(id);
    }

    public List<News> querys() {
        return newsDao.findAll();
    }

    public void save(News news) {
        newsDao.save(news);
    }

    public void update(News news) {
        newsDao.save(news);
    }

    public void delete(News news) {
        newsDao.delete(news);
    }

}
